// 当前的文件路径为: D:\myProject\node-demo
const path = require('path');
console.log(path.join()); // .
console.log(path.join('a', 'b', 'demo.js')); // a\b\demo.js
console.log(path.join(__dirname, 'a', 'b', 'demo.js')); // d:\myProject\node-demo\apps\node-start\path\a\b\demo.js

// 路径开头的 / 不会影响拼接，.. 即（cd ..）代表上一级文件
console.log(path.join(__dirname, '/a', '/b', '..')); // d:\myProject\node-demo\apps\node-start\path\a

// path.join() 会做路径字符串的校验，不合法时会抛错: The "path" argument must be of type string. Received an instance of Object
// console.log(path.join(__dirname, '/a', {}, '/b'));
